/*
 Class file for projectors
 */

#ifndef PROJECTOR_H
#define PROJECTOR_H

#include <QTCore/QString>
#include <QTNetwork/QHostAddress>

namespace Projector
{

    enum ProtocolType
    {
        PROTOCOLTYPE_Unknown = 0,
        PROTOCOLTYPE_PjLink,

        PROTOCOLTYPE_Count
    };

    enum BlackScreenState
    {
        BLACKSCREEN_Unknown = 0,
        BLACKSCREEN_On,
        BLACKSCREEN_Off,

        BLACKSCREEN_Count
    };

    enum PowerState
    {
        POWERSTATE_Unknown = 0,
        POWERSTATE_Off,
        POWERSTATE_On,
        POWERSTATE_Cooling,
        POWERSTATE_Warmup,

        POWERSTATE_Count
    };

    enum InputState
    {
        INPUTSTATE_Unknown = 0,
        INPUTSTATE_Input1,
        INPUTSTATE_Input2,
        INPUTSTATE_Input3,
        INPUTSTATE_Input4,
        INPUTSTATE_video,
        INPUTSTATE_svideo,

        INPUTSTATE_Count
    };

    class Projector
    {

        unsigned int mSDCPPort;
        unsigned int mPJLinkPort;
        unsigned int mHttpPort;

        // the index where the power status is located in a message
        int mPowerStatusIndex;

        // the index where the input status is located in a message
        int mInputStatusIndex;

        // the password for PJLink communication
        bool                mHasPassword;

        QString             mPJLinkV1PW;

        QString             mHostName;
        QString             mName;

        QHostAddress        mAddress;

        BlackScreenState    mBlackScreen;
        InputState          mInputState;
        PowerState          mPowerState;

    protected:
        ProtocolType mProtocolType;

    public:
        Projector();
        //copy constructor
        Projector(const Projector& orig);
        Projector(unsigned int SDCPPort, unsigned int PJLinkPort,
        unsigned int HttpPort, bool hasPassword, QString& PJLinkV1PW, QString& hostName,
        QString& projName, QHostAddress& address);
        virtual ~Projector();


        // Turns the projector on if it is off and vice versa
        bool TurnOnOff() const;
        bool TurnOn() const;
        bool TurnOff() const;

        // Check the current power state
        bool CheckPower();

        // Check the current input state
        bool CheckInput();

        bool SwitchInput(QString &input);

        // Check whether or not the projector has black screen turned on
        bool CheckBlackScreen();

        bool operator< (const Projector& compare);

        /*
        ===================================================
         Getters and Setters below
        ===================================================
        */
        unsigned int GetSDCPPort() const;
        void SetSDCPPort( unsigned int port );

        unsigned int GetPJLinkPort() const;
        void SetPJLinkPort( unsigned int port );

        unsigned int GetHttpPort() const;
        void SetHttpPort( unsigned int port );

        int GetPowerStatusIndex() const;
        void SetPowerStatusIndex( int index );

        int GetInputStatusIndex() const;
        void SetInputStatusIndex( int index );

        QString GetPJLinkV1PW() const;
        void SetPJLinkV1PW( QString& password );

        QHostAddress const GetAddress() const;
        void SetAddress( QHostAddress& address );

        QString GetHostName() const;
        void SetHostName( QString& hostName );

        QString GetName() const;
        void SetName( QString& projName );

        InputState GetInputState() const;
        void SetInputState( InputState inputState );

        PowerState GetPowerState() const;
        void SetPowerState( PowerState powerState );

        BlackScreenState GetBlackScreen() const;
        void SetBlackScreen( BlackScreenState blackScreen );

        ProtocolType GetProtocolType() const;
        void SetProtocolType( ProtocolType protocolType );
        


        /*
         ===================================================

         ===================================================
        */

    };

}

#endif // PROJECTOR_H
